//% extends SigSlot

function Controller( tag )
{
    this.Super();
    
    this.getDisplayObject = function(){ return tag; };
    
    var stage = null;
    
    this.onAddToStage = function( _stage )
    {
        stage = _stage;
    };
    
    this.addChild = function( c )
    {
        this.SigSlot.addChild( c );
        if( c instanceof Controller )
        {
            tag.add( c.getDisplayObject() );
        }
    };
    
    this.removeChild = function( c )
    {
        this.SigSlot.removeChild( c );
        if( c instanceof Controller )
        {
            tag.removeChild( c.getDisplayObject() );
        }
    };
}